package com.qf.service.impl;

import com.qf.dao.EmployeeDao;
import com.qf.pojo.Employee;
import com.qf.service.EmployeeService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
@Service
public class EmployeeServiceImpl implements EmployeeService {
    @Autowired
    private EmployeeDao employeeDao;

    @Override
    public int regist(String name, String password) {
        int res = employeeDao.regist(name, password);
        if(res==1){
            return 1;
        }
        return 0;
    }

    @Override
    public List<Employee> selectAll() {
        return employeeDao.selectAll();
    }

    @Override
    public Employee selectOne(String empId) {
        return employeeDao.selectOne(empId);
    }

    @Override
    public Employee selectByName(String name) {
        return employeeDao.selectByName(name);
    }

    @Override
    public int deleteOne(List<String> empId) {
        int res = employeeDao.deleteOne(empId);
        if (res==1){
            return 1;
        }
        return 0;
    }

    @Override
    public int insertOne(Employee employee) {
        int res = employeeDao.insertOne(employee);
        if(res==1){
            return 1;
        }
        return 0;
    }

    @Override
    public int update(Employee employee) {
        int res = employeeDao.update(employee);
        if(res==1){
            return 1;
        }
        return 0;
    }
}
